#include <stdio.h>

int main()
{
	int num = 0;
	int sum = 0;
	int arr[500] = {0};
	int b = 0;
	for(num = 0; num < 1000; num++)
	{
		//寻找num的因子
		for(int i = 1; i <= num/2; i++ )
		{
			int a = 0;
			a = num % i;
			if(a == 0)
			{
				sum = sum + i;//计算符合条件的因子之和
				arr[b] = i;
				b++;
			}
		}
		if(num == sum)
		{
			printf("%d是完数：",num);
			for(int i = 0; i < b -1;i++ )
			{
				printf("%d,",arr[i]);
			}
			printf("%d\n",arr[b-1]);
		}	
		b = 0;
		sum = 0;
	}

}
